<template>
    <div class="">
        <h2>子组件1</h2>
        <p>子组件1接受的数据:{{ getCount }}</p>
        <GrandSon />
        <button @click="grandChangeFun">儿子组件修改数据</button>
    </div>
</template>

<script setup>
import { inject } from 'vue'
import GrandSon from './GrandSon.vue'

// 由父组件提供,子组件接受
let getCount = inject('count');

let changeCountFun = inject('changeCount');

let grandChangeFun = () => {
    changeCountFun('儿子组件传递的数据')
}


</script>

<style lang="less" scoped>

</style>
